const type = function (value) {
    const helperMap = {
        "[object String]": "String",
        "[object Boolean]": "Boolean",
        "[object Number]": "Number",
        "[object Array]": "Array",
        "[object Object]": "Object",
        "[object Undefined]": "Undefined",
        "[object Null]": "Null",
        "[object Symbol]": "Symbol",
    }
    if(value !== value){
        return 'NaN'
    }else{
        return helperMap[Object.prototype.toString.call(value)]
    }
}
const json2params = function (json) {
    if(type(json) === "Object"){
        let target = [];
        for(let key in json){
            target.push(key+'='+json[key])
        }
        return target.join('&')
    }else{
        throw "json2params方法需要传入json对象"
    }
}

export {
    type,
    json2params
}